package com.example.demo.controller;

import com.example.demo.enity.Role;
import com.example.demo.enity.Student;
import com.example.demo.service.IRoleService;
import com.example.demo.service.IStudentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@SuppressWarnings({"all"})
@Controller
@RequestMapping("/stu")
public class StudentController {

    @Autowired
    private IStudentService studentService;

    @Autowired
    private IRoleService roleService;

    @RequestMapping("/getstu/{id}")
    @ResponseBody
    public Student findById(@PathVariable("id") Integer id) {
        return studentService.findById(id);
    }

    @RequestMapping("/getrole/{id}")
    @ResponseBody
    public Role findByRoleId(@PathVariable("id") Integer id) {
        return roleService.findById(id);
    }

}
